package terminal_enum

import "gitee.com/lailonghui/vehicle-supervision-framework/pkg/dicts"

// 终端-测试结果
type testResult int

var TestResult testResult

// 通过
func (c *testResult) Pass() int {
	return 1
}

// 不通过
func (c *testResult) Unpass() int {
	return 2
}

func (c *testResult) ToText(value int) string {
	switch value {

	case 1:
		return "通过"

	case 2:
		return "不通过"

	}
	return ""
}

func (c *testResult) ToDict(value int) *dicts.IntDict {
	return &dicts.IntDict{
		Text:  c.ToText(value),
		Value: value,
	}
}

func (c *testResult) ToValue(text string) int {
	switch text {

	case "通过":
		return 1

	case "不通过":
		return 2

	}
	return 0
}
